package com.example.service.imple;

import com.example.dao.BooksMapper;
import com.example.entity.Books;
import com.example.service.BooksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BooksServiceImpl implements BooksService {
    @Autowired
    private BooksMapper booksMapper;

    @Override
    public List<Books> getAllBookss() {
        return booksMapper.listBookss();
    }

    @Override
    public List<Books> listBookssByParams(Map<String, Object> params) {
        return booksMapper.listBookssByParams(params);
    }

    public Integer addBooks(Books Books) {
        booksMapper.insertBooks(Books);
        return Books.getId();
    }

    public Integer updateBooks(Books Books) {
        booksMapper.updateBooks(Books);
        return Books.getId();
    }

    public Integer deleteBooks(int id) {
        booksMapper.deleteBooksById(id);
        return id;
    }

    public void deleteBookss(List<String> ids) {
        booksMapper.deleteBookss(ids);
       // return id;
    }

    public Books getBooksById(int id) {
        return booksMapper.getBooksById(id);
    }
}